<?php

/**
 * This is the model class for table "interventions_realisees".
 *
 * The followings are the available columns in table 'interventions_realisees':
 * @property integer $ID_INTERVENTION
 * @property integer $ID_PERSONNEL_TECHNIQUE
 * @property integer $ID_BILLET_INCIDENT
 * @property string $DATE_INTERVENTION
 * @property string $COMMENTAIRES_INTERVENTION
 * @property integer $ID_INTERVENTIONS_REALISEES
 *
 * The followings are the available model relations:
 * @property BilletIncident $iDBILLETINCIDENT
 * @property TypeIntervention $iDINTERVENTION
 * @property PersonnelTechnique $iDPERSONNELTECHNIQUE
 */
class InterventionsRealisees extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return InterventionsRealisees the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'interventions_realisees';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ID_INTERVENTION, ID_PERSONNEL_TECHNIQUE, ID_BILLET_INCIDENT, DATE_INTERVENTION, ID_INTERVENTIONS_REALISEES', 'required'),
			array('ID_INTERVENTION, ID_PERSONNEL_TECHNIQUE, ID_BILLET_INCIDENT, ID_INTERVENTIONS_REALISEES', 'numerical', 'integerOnly'=>true),
			array('COMMENTAIRES_INTERVENTION', 'length', 'max'=>500),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ID_INTERVENTION, ID_PERSONNEL_TECHNIQUE, ID_BILLET_INCIDENT, DATE_INTERVENTION, COMMENTAIRES_INTERVENTION, ID_INTERVENTIONS_REALISEES', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'iDBILLETINCIDENT' => array(self::BELONGS_TO, 'BilletIncident', 'ID_BILLET_INCIDENT'),
			'iDINTERVENTION' => array(self::BELONGS_TO, 'TypeIntervention', 'ID_INTERVENTION'),
			'iDPERSONNELTECHNIQUE' => array(self::BELONGS_TO, 'PersonnelTechnique', 'ID_PERSONNEL_TECHNIQUE'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ID_INTERVENTION' => 'Id Intervention',
			'ID_PERSONNEL_TECHNIQUE' => 'Id Personnel Technique',
			'ID_BILLET_INCIDENT' => 'Id Billet Incident',
			'DATE_INTERVENTION' => 'Date Intervention',
			'COMMENTAIRES_INTERVENTION' => 'Commentaires Intervention',
			'ID_INTERVENTIONS_REALISEES' => 'Id Interventions Realisees',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ID_INTERVENTION',$this->ID_INTERVENTION);
		$criteria->compare('ID_PERSONNEL_TECHNIQUE',$this->ID_PERSONNEL_TECHNIQUE);
		$criteria->compare('ID_BILLET_INCIDENT',$this->ID_BILLET_INCIDENT);
		$criteria->compare('DATE_INTERVENTION',$this->DATE_INTERVENTION,true);
		$criteria->compare('COMMENTAIRES_INTERVENTION',$this->COMMENTAIRES_INTERVENTION,true);
		$criteria->compare('ID_INTERVENTIONS_REALISEES',$this->ID_INTERVENTIONS_REALISEES);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}